<!DOCTYPE html>
<html>
  
<head>
  <meta charset="utf-8">
  <meta name="author" content="饿包子" />
  
  
  <title>Hexo在使用过程中遇到的问题 | 饿包子博客</title>

  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  
    <meta name="keywords" content="使用指南,Hexo," />
  

  
  <meta name="description" content="在Hexo的使用过程中，遇到了一些小问题，虽然是小问题，但显的特别无奈，网友遭遇千千万，想找个答案也是困难，所以记录下这些问题，希望能帮到一些人。也许在有的人看来这些都不是什么问题，也许只是一时没转过弯来，那么会心一笑就好了">

  
  
    <link rel="icon" href="/blog/images/xian.ico">
    <link rel="apple-touch-icon" href="/blog/images/Logo.png">
  

  
<link rel="stylesheet" href="/blog/css/Awesome.min.css">


  
<link rel="stylesheet" href="/blog/css/index.css">
<link rel="stylesheet" href="/blog/styles/components/highlight/highlight.css">


  
  
<script src="/blog/common/jquery.min.js"></script>

  
    
<script src="/blog/common/Av.min.js"></script>

  

  
    
<script src="/blog/common/MathJax.js"></script>

  

  
    
<script src="/blog/common/Valine.min.js"></script>

  

  

  <script>
  // theme-ad's config script
  // it can be used in every script
  
  window.AD_CONFIG = {
    leancloud: {"appid":"gE1EosDsVgB2slV4E92yPkcG-gzGzoHsz","appkey":"niR787UVTMyJQrR6gmOiJCKe","comment":true,"count":true},
    welcome: {"enable":false,"interval":30},
    start_time: "2018-06-10",
    passwords: ["a621ab606db2a11f63edc576a729843b8269250dc324206871d90635ac5e531c", ],
    is_post: true,
    lock: false,
    author: "饿包子",
    share: {"twitter":false,"facebook":false,"weibo":true,"qq":true,"wechat":false},
    mathjax: true,
    page_type: "",
    root: "/blog/"
  };
</script>

  
<script src="/blog/vendor/sha256.min.js"></script>
<script src="/blog/js/auth.js"></script>
<script src="/blog/js/index.js"></script>
<script src="/blog/vendor/qrcode.min.js"></script>


<meta name="generator" content="Hexo 5.4.2"></head>
  <body>
    <header class="site-header">
  <div class="site-header-brand">
    
      <span class="site-header-brand-title">
        <a href="/blog/">清风逐月</a>
      </span>
    
    
      <span class="site-header-brand-motto"> | 我思故我在</span>
    
  </div>
  <div class="site-header-right">
    <nav class="site-header-navigation">
      
        <a href="/blog/" target="_self">主页</a>
      
        <a href="/blog/archives/" target="_self">归档</a>
      
        <a href="/blog/tags/" target="_self">标签</a>
      
        <a href="/blog/categories/" target="_self">分类</a>
      
        <a href="/blog/categories/%E6%97%A5%E8%AE%B0" target="_self">日记</a>
      
    </nav>
    <div class="site-header-btn">
      
        <a href="https://github.com/lixianbin1/" target="_blank" id="site-github">
          <i class="fa fa-github-alt"></i>
        </a>
      
      <a href="javascript:void(0);" id="site-search">
        <i class="fa fa-search"></i>
      </a>
      <a href="javascript:void(0);" id="site-nav-btn">
        <i class="fa fa-ellipsis-v"></i>
      </a>
    </div>
  </div>
</header>
<nav class="table-content" id="site-nav">
  <div class="table-content-title">
    <span>导航</span>
  </div>
  <div class="table-content-main">
    <ol class="toc">
      
        <li class="toc-item">
          <a href="/blog/" target="_self">
            主页
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/archives/" target="_self">
            归档
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/tags/" target="_self">
            标签
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/categories/" target="_self">
            分类
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/categories/%E6%97%A5%E8%AE%B0" target="_self">
            日记
          </a>
        </li>
      
    </ol>
  </div>
</nav>
<div id="site-process"></div>
    <main>
      
  <div class="passage">
  <div class="passage-meta">
    <span>
      <i class="fa fa-calendar"></i>2019-04-25
    </span>
    
      <span>
        | <a href="/blog/categories/%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/"><i class="fa fa-bookmark"></i>使用指南</a>
      </span>
    
    
      <span>
        | <i class="fa fa-unlock-alt"></i>UNLOCK
      </span>
    
    <span>
       | <i class="fa fa-calendar"></i>更新时间:2019-9-16 17:33 
    </span>
  </div>
  <h1 class="passage-title">
    Hexo在使用过程中遇到的问题
  </h1>
  
  <article class="passage-article">
    <h2 id="Hexo-的菜单增加及国际化（i18n）"><a href="#Hexo-的菜单增加及国际化（i18n）" class="headerlink" title="Hexo 的菜单增加及国际化（i18n）"></a>Hexo 的菜单增加及国际化（i18n）</h2><p>大家都知道，Hexo提供国际化（i18n）的功能，却发现大家都比较少用，然后大家的菜单都是直接中文上去，我觉得大家有机会还是可以用一下，毕竟github是一个面向世界的网站</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new page pageone</span><br><span class="line"># 会在source目录下生成 pageone 目录及index.md</span><br></pre></td></tr></table></figure>

<ul>
<li>Hexo在主题themes主题目录下的_config.yml配置着导航菜单的内容</li>
</ul>
<figure class="highlight plaintext"><figcaption><span>_config.yml</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">menu:</span><br><span class="line">  Home: /</span><br><span class="line">  Archives: /archives</span><br><span class="line">  Pageone: /pageone</span><br></pre></td></tr></table></figure>
<ul>
<li>Hexo在themes主题目录下各主题会配置一个languages目录，里面有各个语言翻译</li>
</ul>
<figure class="highlight plaintext"><figcaption><span>themes/languages/zh-CN.yml</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Home: 主页</span><br><span class="line">Archives: 归档</span><br><span class="line">Pageone: 新的页面</span><br></pre></td></tr></table></figure>

<ul>
<li>i18n 使用 __ 或 _p 辅助函数，来获取翻译后的字符串，前者用于一般情况；而后者用于复数字符串<figure class="highlight plaintext"><figcaption><span>themes/landscape/layout/_partial/header.ejs</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&lt;nav id=&quot;main-nav&quot;&gt;</span><br><span class="line">  &lt;a id=&quot;main-nav-toggle&quot; class=&quot;nav-icon&quot;&gt;&lt;/a&gt;</span><br><span class="line">  &lt;% for (var i in theme.menu)&#123; %&gt;</span><br><span class="line">    &lt;a class=&quot;main-nav-link&quot; href=&quot;&lt;%- url_for(theme.menu[i]) %&gt;&quot;&gt;&lt;%= __(i) %&gt;&lt;/a&gt;</span><br><span class="line">  &lt;% &#125; %&gt;</span><br><span class="line">&lt;/nav&gt;</span><br></pre></td></tr></table></figure>
我上面所配置都是Hexo的默认主题，每个主题文件及相关配置有一定的不同，大家知道这个思路就行，不要生搬硬套<h2 id="修改的配置信息后没有变化"><a href="#修改的配置信息后没有变化" class="headerlink" title="修改的配置信息后没有变化"></a>修改的配置信息后没有变化</h2>当我修改网站的配置信息的时候，刷新本地浏览器，发现页面的好像没有变化，我以为是缓存，清除缓存并没有改变，我想会不会是编译出错，hexo clean 后再次编译，发现并没有改变，最后发现：</li>
<li>Hexo根目录下的_config.yml配置后，要重新启动 Hexo server </li>
<li>themes主题目录下的_config.yml主题配置目录则只需刷新即可</li>
</ul>
<h2 id="文章和草稿"><a href="#文章和草稿" class="headerlink" title="文章和草稿"></a>文章和草稿</h2><p>Hexo 传统的创建文章的命令，创建文章，之后通过发布命令发布文章</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new &lt;title&gt;</span><br></pre></td></tr></table></figure>

<p>如果你有篇文章还没写完，不想发布，你肯定需要草稿功能，</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new draft &lt;title&gt;</span><br></pre></td></tr></table></figure>

<p>在 <code>source/</code> 目录下会建立 <code>_drafts</code> 文件夹：所有的草稿都会在里面<br>当你编辑中想要预览草稿，可以执行下面的命令</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo S --draft</span><br></pre></td></tr></table></figure>

<p>当你写完后，你可以通过下面的命令将草稿转存在 <code>_posts</code> 目录下，等待发布<br>当然，你也可以手动移动文件或者创建文件夹</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo P &lt;filename&gt;</span><br></pre></td></tr></table></figure>


<h2 id="报错"><a href="#报错" class="headerlink" title="报错"></a>报错</h2><h3 id="template-render-error"><a href="#template-render-error" class="headerlink" title="template render error"></a>template render error</h3><p>template render error (unknown path) 模板呈现错误(未知路径),如果出现这个报错提示,基本就是你文章里的代码 没有进行闭合操作，好好检查一下</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&#123;% codeblock %&#125;</span><br><span class="line">&lt;nav id=&quot;main-nav&quot;&gt;&lt;/nav&gt;</span><br><span class="line"></span><br><span class="line"># 像上面一样少了闭合代码，就会报错</span><br></pre></td></tr></table></figure>

<h3 id="The-“mode”-argument-must-be-integer"><a href="#The-“mode”-argument-must-be-integer" class="headerlink" title="The “mode” argument must be integer"></a>The “mode” argument must be integer</h3><p>Hexo 版本和 node 版本支持不一致导致；可以更新 node或者 Hexo</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"></span><br></pre></td></tr></table></figure>


<blockquote>
<p>当然，这是一个会更新的文章，当我遇到有意思的或者网上比较难找到答案的，我会记录下来</p>
</blockquote>
  </article>
  <aside class="table-content" id="site-toc">
  <div class="table-content-title">
    <i class="fa fa-arrow-right fa-lg" id="site-toc-hide-btn"></i>
    <span>目录</span>
  </div>
  <div class="table-content-main">
    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Hexo-%E7%9A%84%E8%8F%9C%E5%8D%95%E5%A2%9E%E5%8A%A0%E5%8F%8A%E5%9B%BD%E9%99%85%E5%8C%96%EF%BC%88i18n%EF%BC%89"><span class="toc-text">Hexo 的菜单增加及国际化（i18n）</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E7%9A%84%E9%85%8D%E7%BD%AE%E4%BF%A1%E6%81%AF%E5%90%8E%E6%B2%A1%E6%9C%89%E5%8F%98%E5%8C%96"><span class="toc-text">修改的配置信息后没有变化</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E7%AB%A0%E5%92%8C%E8%8D%89%E7%A8%BF"><span class="toc-text">文章和草稿</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8A%A5%E9%94%99"><span class="toc-text">报错</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#template-render-error"><span class="toc-text">template render error</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#The-%E2%80%9Cmode%E2%80%9D-argument-must-be-integer"><span class="toc-text">The “mode” argument must be integer</span></a></li></ol></li></ol>
  </div>
</aside>

  
  
    <aside class="passage-copyright">
      <div>本文作者: 饿包子</div>
      
        <div>
          原文链接: 
          <a href="" target="_blank">https://lixianbin1.github.io/blog/2019/04/25/%E3%80%90%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97%E3%80%91Hexo%E5%9C%A8%E4%BD%BF%E7%94%A8%E8%BF%87%E7%A8%8B%E4%B8%AD%E9%81%87%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98/</a>
        </div>
      
      <div>
        版权声明: 本博客所有文章除特别声明外, 均采用 <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> 许可协议. 转载请注明出处!
      </div>
    </aside>
  
  
    <div class="passage-tags">
     
      <a href="/blog/tags/Hexo/"><i class="fa fa-tags"></i>Hexo</a>
    
    </div>
  
</div>

    </main>
    
      
<div class="site-comment-contanier" data-plateform="leancloud">
  
    <p id="site-comment-info">
      <i class="fa fa-spinner fa-spin"></i> 评论加载中
    </p>
    <div id="site-comment"></div>
  
</div>
    
    
<div class="site-footer-wrapper">
<!--
  <div class="footer-top">
    <a class="left" href="/blog/2019/04/27/React-16-8-%E6%96%B0%E5%A2%9E%E7%89%B9%E6%80%A7-Hook/" data-enable="true">
      <i class="fa fa-arrow-left"></i>
    </a>
    <a class="right" href="/blog/2018/09/04/%E5%85%B3%E4%BA%8E%E5%B1%8F%E5%B9%95%E9%80%82%E9%85%8D%E7%9A%84%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98/" data-enable="true">
      <i class="fa fa-arrow-right"></i>
    </a>
  </div>
-->
  <footer class="site-footer">
    
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">网站推荐</h5>
          
            <span class="site-footer-item">
              <a href="https://tympanus.net/codrops/" target="_blank">Codrops</a>
            </span>
          
            <span class="site-footer-item">
              <a href="http://taobaofed.org/" target="_blank">淘宝前端团队(FED)</a>
            </span>
          
        </div>
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">文档教程</h5>
          
            <span class="site-footer-item">
              <a href="https://es6.ruanyifeng.com/" target="_blank">ES6入门</a>
            </span>
          
            <span class="site-footer-item">
              <a href="https://developer.mozilla.org/zh-CN/docs/Web" target="_blank">MDN Web文档</a>
            </span>
          
        </div>
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">兴趣前沿</h5>
          
            <span class="site-footer-item">
              <a href="https://threejs.org/" target="_blank">threejs</a>
            </span>
          
            <span class="site-footer-item">
              <a href="https://github.com/justadudewhohacks/face-api.js" target="_blank">face-api</a>
            </span>
          
        </div>
      
    
    <div class="site-footer-info">
      <i class="fa fa-clock-o"></i> 本站已稳定运行<span id="site-time"></span>
    </div>
    
      <div class="site-footer-info">
        <i class="fa fa-paw"></i> 您是本站第 <span id="site-count"></span> 位访客
      </div>
    
    
      <div class="site-footer-info">
        <i class="fa fa-at"></i> Email: xianbin.me@qq.com
      </div>
    
<!--     <div class="site-footer-info">
      <i class="fa fa-copyright"></i> 
      2019 <a href="https://github.com/dongyuanxin/theme-ad/" target="_blank">Theme-AD</a>.
      Created by <a href="https://godbmw.com/" target="_blank">GodBMW</a>.
      All rights reserved.
    </div> -->
  </footer>
</div>
    <div id="site-layer" style="display:none;">
  <div class="site-layer-content">
    <div class="site-layer-header">
      <span class="site-layer-header-title" id="site-layer-title"></span>
      <i class="fa fa-close" id="site-layer-close"></i>
    </div>
    <div class="site-layer-body" id="site-layer-container">
      <div class="site-layer-input" id="site-layer-search" style="display: none;">
        <input type="text">
        <i class="fa fa-search"></i>
      </div>
      
        <div class="site-layer-reward" id="site-layer-reward" style="display: none;">
          
            <div>
              <img src="/blog/images/wechat.png" alt="WeChat">
              
                <p>WeChat</p>
              
            </div>
          
            <div>
              <img src="/blog/images/alipay.png" alt="AliPay">
              
                <p>AliPay</p>
              
            </div>
          
        </div>
      
      <div id="site-layer-welcome" style="display:none;"></div>
    </div>
  </div>
</div>
    

<div class="bottom-bar">

  <div class="bottom-bar-left">
<!--
    <a href="/blog/2019/04/27/React-16-8-%E6%96%B0%E5%A2%9E%E7%89%B9%E6%80%A7-Hook/" data-enable="true">
      <i class="fa fa-arrow-left"></i>
    </a>
    <a href="/blog/2018/09/04/%E5%85%B3%E4%BA%8E%E5%B1%8F%E5%B9%95%E9%80%82%E9%85%8D%E7%9A%84%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98/" data-enable="true">
      <i class="fa fa-arrow-right"></i>
    </a>
-->
  </div>

  
  
  
  <div class="bottom-bar-right">
    <a href="javascript:void(0);" data-enable="true" id="site-toc-show-btn">
      <i class="fa fa-bars"></i>
    </a>
    
      <a href="#site-comment" data-enable="true">
        <i class="fa fa-commenting"></i>
      </a>
    
    <a href="javascript:void(0);" id="site-toggle-share-btn">
      <i class="fa fa-share-alt"></i>
    </a>
    
    <a href="javascript:void(0);" id="back-top-btn">
      <i class="fa fa-chevron-up"></i>
    </a>
  </div>
</div>
    <div id="share-btn">
  
  
  
    <a id="share-btn-weibo" href="javascript:void(0);" target="_blank">
      <i class="fa fa-weibo"></i>
    </a>
  
  
    <a id="share-btn-qq" href="javascript:void(0);" target="_blank">
      <i class="fa fa-qq"></i>
    </a>
  
  
</div>
    





    
  </body>
</html>